Skip to content

[None][chore] replace mktemp#15725

Open
tburt-nv wants to merge 2 commits into
NVIDIA:mainfrom
tburt-nv:user/tburt/replace_mktemp
Open

[None][chore] replace mktemp#15725
tburt-nv wants to merge 2 commits into
NVIDIA:mainfrom
tburt-nv:user/tburt/replace_mktemp

Conversation

@tburt-nv

@tburt-nv tburt-nv commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

Description

mktemp is deprecated, so this PR replaces it with TemporaryDirectory in the test code.

Test Coverage

PR Checklist

Please review the following before submitting your PR:

  • PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.

  • PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.

  • Test cases are provided for new code paths (see test instructions)

  • If PR introduces API changes, an appropriate PR label is added - either api-compatible or api-breaking. For api-breaking, include BREAKING in the PR title.

  • Any new dependencies have been scanned for license and vulnerabilities

  • CODEOWNERS updated if ownership changes

  • Documentation updated as needed

  • Update tava architecture diagram if there is a significant design change in PR.

  • The reviewers assigned automatically/manually are appropriate for the PR.

  • Please check this after reviewing the above items as appropriate for this PR.

GitHub Bot Help

To see a list of available CI bot commands, please comment /bot help.

Summary by CodeRabbit

  • Tests
    • Improved test coverage for the builder configuration flow by using a safer temporary file approach.

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Replaces tempfile.mktemp() with tempfile.NamedTemporaryFile(delete=False) in test_basic_builder_flow, using the resulting file's .name attribute as the config save path.

Changes

Builder Test Fix

Layer / File(s) Summary
Replace deprecated mktemp
tests/unittest/others/test_builder.py
Temporary file creation switches from tempfile.mktemp() to tempfile.NamedTemporaryFile(delete=False), with tmp.name passed to builder.save_config.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the change to replace mktemp with NamedTemporaryFile and follows the required format.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The PR follows the template and explains the change, with only Test Coverage left unfilled.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/unittest/others/test_builder.py`:
- Around line 60-61: The test around builder.save_config is reusing tmp.name
while the NamedTemporaryFile handle is still open, which can fail on Windows,
and delete=False leaves the temp file behind. Update the test in test_builder.py
to close the temporary file before calling builder.save_config and ensure the
file is removed afterward, ideally using a try/finally or teardown cleanup
around the tempfile.NamedTemporaryFile usage.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: c8231579-77fc-475e-b8c7-bb463066a4cb

📥 Commits

Reviewing files that changed from the base of the PR and between 833ddd2 and 53aae2e.

📒 Files selected for processing (1)
  • tests/unittest/others/test_builder.py

Comment thread tests/unittest/others/test_builder.py Outdated
tburt-nv added 2 commits June 29, 2026 09:07
Signed-off-by: Tyler Burt <195370667+tburt-nv@users.noreply.github.com>
Signed-off-by: Tyler Burt <195370667+tburt-nv@users.noreply.github.com>
@tburt-nv tburt-nv force-pushed the user/tburt/replace_mktemp branch from ca759bb to e77db5e Compare June 29, 2026 16:07
@tburt-nv

Copy link
Copy Markdown
Collaborator Author

/bot run --stage-list "A100X-TensorRT-Post-Merge-*"

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #56403 [ run ] triggered by Bot. Commit: e77db5e Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #56403 [ run ] completed with state FAILURE. Commit: e77db5e
/LLM/main/L0_MergeRequest_PR pipeline #45246 (Partly Tested) completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@tburt-nv

Copy link
Copy Markdown
Collaborator Author

/bot run --stage-list "A100X-TensorRT-Post-Merge-*"

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #56423 [ run ] triggered by Bot. Commit: e77db5e Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #56423 [ run ] completed with state FAILURE. Commit: e77db5e
/LLM/main/L0_MergeRequest_PR pipeline #45266 (Partly Tested) completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants